﻿namespace Core.Implementation
{
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using Domain;
	using NHibernate;
	using NHibernate.Linq;

	internal class NHibernateAccountRepository : NHibernateRepository<Account>, IAccountRepository
	{
		public NHibernateAccountRepository(ISession session) : base(session)
		{
		}

		public Account GetByEmail(string email)
		{
			return this.Query().First(a => a.Person.EmailAddress == email);
		}

		public IEnumerable<Account> EnumerateAccounts()
		{
			throw new NotImplementedException();
		}

		public bool ContainsWithEmail(string email)
		{
			throw new NotImplementedException();
		}

		public void Save(Account account)
		{
			this.Session.Save(account);
		}
	}
}
